From f04d7df6e6d5b350740e01d24749a3930390b7a0 Mon Sep 17 00:00:00 2001
From: Nils Goroll <nils.goroll@uplex.de>
Date: Thu, 15 Oct 2020 12:01:35 +0200
Subject: [PATCH] vtest: put cwd on the stack

0051cbe3b9cc24586e0ad99cff72041c6df944b8 did not work on
solaris-descendents, the man page clearly states that the size argument
also determines the buffer to be malloc()ed for a NULL buffer argument.
---
 bin/varnishtest/vtc_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index 3c3887450c..1b322f8dea 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -686,6 +686,7 @@ main(int argc, char * const *argv)
 	int use_cleaner = 0;
 	uintmax_t bufsiz;
 	const char *p;
+	char buf[PATH_MAX];
 
 	argv0 = strrchr(argv[0], '/');
 	if (argv0 == NULL)
@@ -698,7 +699,7 @@ main(int argc, char * const *argv)
 	else
 		tmppath = strdup("/tmp");
 
-	cwd = getcwd(NULL, 0);
+	cwd = getcwd(buf, sizeof buf);
 	extmacro_def("pwd", "%s", cwd);
 
 	vmod_path = NULL;
